package com.atguigu.yygh.order.receiver;

import com.atguigu.yygh.order.service.OrderInfoService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @author 孔德成
 * @slogan 致敬大师，致敬未来的你
 * @date 2021/9/15 9:39 下午
 * @desc 就诊短信队列接收者
 */
@Component
@Slf4j
@RabbitListener(queues = "yygh.msm.patient.tip")
public class PatientTipsReceiver {

    @Autowired
    private OrderInfoService orderInfoService;


    /**
     * 从队列中接收到消息后，调用业务层的就诊提醒方法
     */
    @RabbitHandler
    public void send(String message) {
        log.info(message);
        orderInfoService.patientTips();
    }
}
